{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
}}

<PageHeader as |p|>
  <p.levelLeft>
    <h1 class="title is-3">
      <LinkTo @route="vault.cluster.access.leases">Leases</LinkTo>
    </h1>
  </p.levelLeft>
</PageHeader>
{{! template-lint-configure simple-unless "warn" }}
{{#unless (or (eq this.model.httpStatus 400) (eq this.model.httpStatus 404))}}
  {{this.model.message}}
{{/unless}}

{{#if (eq this.model.httpStatus 400)}}
  <Hds::Alert @type="inline" @color="critical" class="has-bottom-margin-s" as |A|>
    <A.Title>Error</A.Title>
    <A.Description>{{this.model.keyId}} is not a valid lease ID.</A.Description>
  </Hds::Alert>
{{else if (eq this.model.httpStatus 404)}}
  <EmptyState
    @title="No leases with that ID"
    @message="Unable to find lease for the ID &quot;{{this.model.keyId}}&quot;. Try going back to the lookup and re-entering the ID."
  >
    <Hds::Link::Standalone @icon="chevron-left" @text="Back to lookup" @route="vault.cluster.access.leases" />
  </EmptyState>
{{else if (eq this.model.httpStatus 403)}}
  <EmptyState
    @title="You don't have access to a lease with that ID"
    @message="If you think you've reached this page in error, please contact your administrator."
  >
    <Hds::Link::Standalone @icon="chevron-left" @text="Back to lookup" @route="vault.cluster.access.leases" />
  </EmptyState>
{{else}}
  {{#each this.model.errors as |error|}}
    <Hds::Alert @type="inline" @color="critical" class="has-bottom-margin-s" as |A|>
      <A.Title>Error</A.Title>
      <A.Description>{{error}}</A.Description>
    </Hds::Alert>
  {{/each}}
{{/if}}